{include file="public/header" /}
{load href="__PLUGINS__iCheck/icheck.min.js"}
{load href="__PLUGINS__iCheck/custom.css"}
<!-- 加载编辑器的容器 -->
{:ueditor()}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <form class="form-horizontal" method="post">
            <div class="col-sm-12">
                <div class="tabs-container">
                    <div class="tab-content">
                        <div class="ibox-content">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">类型：</label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="type" onchange="chan(this)">
                                        <!--<option value="0" {present name="name"}{if condition="$name.type == 0"}selected="selected"{/if}{/present}>个人动态</option>
                                        <option value="1" {present name="name"}{if condition="$name.type == 1"}selected="selected"{/if}{/present}>爱情故事</option>
                                        <option value="2" {present name="name"}{if condition="$name.type == 2"}selected="selected"{/if}{/present}>系统广播</option>-->
                                        <option value="3" {present name="name"}{if condition="$name.type == 3"}selected="selected"{/if}{else /}selected="selected"{/present}>视频</option>
                                        <option value="4" {present name="name"}{if condition="$name.type == 4"}selected="selected"{/if}{/present}>图集</option>
                                    </select>
                                </div>
                            </div>
                            <!--<div class="form-group" id="top" {present name="name"}{if condition="$name.type == 2"}style="display: block"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">置顶：</label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="top" >
                                        <option value="0" {present name="name"}{if condition="$name.top == 0"}selected="selected"{/if}{/present}>否</option>
                                        <option value="1" {present name="name"}{if condition="$name.top == 1"}selected="selected"{/if}{/present}>是</option>
                                    </select>
                                </div>
                            </div>-->
                            <!--<div class="form-group" id="category_id" {present name="name"}{if condition="$name.type == 3"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">分类：</label>
                                <div class="col-sm-9">
                                    <select class="form-control" name="category_id">
                                        {php}
                                        if(isset($name)){
                                        $typeidname=$name['category_id'];
                                        }else{
                                        $typeidname='';
                                        }
                                        {/php}

                                        {volist name='category' id='v'}
                                        <option value="{$v.id}" {eq name="v.id" value="$typeidname" }selected{/eq}>{:str_repeat("&nbsp;&nbsp;&nbsp;&nbsp;", $v['depth'])}{gt name="$v['depth']" value="0"}┠&nbsp;&nbsp;{/gt}{$v.name}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>-->
                            <div class="form-group" id="userid" {present name="name"}{if condition="$name.type == 3"}style="display: none"{/if}{/present}>
                                <label class="col-sm-2 control-label">用户：</label>
                                <div class="col-sm-9">
                                    <input name="userid" type="number" class="form-control" value="{present name='name'}{$name.userid}{else /}<?php if (input('userid')) {echo input('userid');}?>{/present}">
                                </div>
                            </div>
                            <!--<div class="form-group" id="to_user" {present name="name"}{if condition="$name.type == 3"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">对方：</label>
                                <div class="col-sm-9">
                                    <input name="to_user" type="number" class="form-control" value="{present name='name'}{if condition = '$name.to_user'}{$name.to_user}{/if}{else /}<?php if (input('to_user')) {echo input('to_user');}?>{/present}">
                                </div>
                            </div>-->
                            <div class="form-group">
                                <label class="col-sm-2 control-label">点赞数：</label>
                                <div class="col-sm-9">
                                    <input name="thumbsup" type="number" class="form-control" value="{present name='name'}{$name.thumbsup}{/present}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">评论数：</label>
                                <div class="col-sm-9">
                                    <input name="comments" type="number" class="form-control" value="{present name='name'}{$name.comments}{/present}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">浏览量：</label>
                                <div class="col-sm-9">
                                    <input name="visit" type="number" class="form-control" value="{present name='name'}{$name.visit}{/present}">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">内容：</label>
                                <div class="col-sm-9">
                                    <textarea name="content" id="content" style="height: 400px;width: 100%">{present name="name"}{$name.content}{/present}</textarea>
                                </div>
                            </div>


                            <div class="form-group" id="imageDiv" {present name="name"}{if condition="$name.type == 3"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">图片：</label>
                                <div class="col-sm-9">
                                    <div id="demo"></div>
                                </div>
                            </div>

                            <input name="masterimg" id="images" type="hidden" class="form-control" value="">

                            <style type="text/css">
                                .meiyouuimmag{
                                    margin-bottom: 20px;
                                    height:284px;
                                    overflow: hidden;
                                }
                                .meiyouuimmag div{
                                    width: 100%;
                                    margin-bottom: 10px;
                                    overflow:hidden;
                                    height: 200px
                                }
                                .meiyouuimmag div img{
                                    width: 100%
                                }
                                .meiyouuimmag button{
                                    position: absolute;
                                    right: 15px;
                                    display: block;
                                }
                                #imagasdasd{
                                    margin-left: 100px;
                                    margin-right: 100px;
                                }
                            </style>

                            <div class="form-group" id="imagasdasd" {present name="name"}{if condition="$name.type == 3"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                {present name="$name"}
                                {if condition="$name.masterimg"}
                                {php}$imagesdata = json_decode($name['masterimg'],TRUE);$k=0;{/php}
                                {foreach $imagesdata as $v}
                                <div class="col-md-3 col-sm-4 col-xs-6 meiyouuimmag" id="id{$k}">
                                    <button type="button" class="btn btn btn-sm btn-danger" onclick="delImg({$k})">删除</button>
                                    <div class="im"><img src="__ROOT__{$v}" >  </div>
                                    <textarea data-img="{$v}" style="resize:none" class="form-control" rows="3"></textarea>
                                </div>
                                <?php $k++;?>
                                {/foreach}
                                {/if}
                                {/present}
                            </div>

                            <!-- 引用控制层插件样式 -->
                            {load href="__PLUGINS__zyUpload/zyUpload.css"}
                            <!-- 引用核心层插件 -->
                            {load href="__PLUGINS__zyUpload/zyUpload.js"}
                            <!-- 引用初始化JS -->
                            <script type="text/javascript">var urlupload='{:url('index/uploads')}'; var root = '__ROOT__'</script>
                            {load href="__PLUGINS__zyUpload/script.js"}

                            <div class="form-group" id="videoDiv" {present name="name"}{if condition="$name.type == 4"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">视频：</label>
                                <div class="col-sm-9">
                                    <div class="input-group">
                                        <video src="{present name='name.video'}{if condition='$name.video'}__ROOT__{$name.video}{/if}{/present}" volume="0.5" controls preload="true" playsinline webkit-playsinline="webkit-playsinline" x-webkit-airplay="allow" style="max-width: 200px;" id="video">您的浏览器不支持播放本视频</video>
                                        <input name="video" type="hidden"  id="videoval" class="form-control" value="{present name='name'}{$name.video}{/present}">
                                        <span class="input-group-btn" id="videowatch">
                                            <button type="button" class="btn btn-primary" id="videos">上传</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group" id="coverDiv" {present name="name"}{if condition="$name.type == 4"}style="display: none"{/if}{else /}style="display: none"{/present}>
                                <label class="col-sm-2 control-label">封面：</label>
                                <div class="col-sm-9">
                                    <div class="input-group">
                                        <img src="{present name='name.cover'}{if condition='$name.cover'}__ROOT__{$name.cover}{else /}__IMG__add_img.png{/if}{else /}__IMG__add_img.png{/present}" id="imageimg" style="max-width: 200px">
                                        <input name="cover" type="hidden"  id="image" class="form-control" value="{present name='name'}{$name.cover}{/present}">
                                        <span class="input-group-btn">
                                            <button type="button" class="btn btn-primary" id="tubiao">上传</button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">

    layui.use(['laydate'], function(){
        var laydate = layui.laydate;
        var form = layui.form;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
            ,trigger: 'click'
        });
    })


    $(document).ready(function(){
        $(".i-checks").iCheck({
            checkboxClass: "icheckbox_square-green",
            radioClass: "iradio_square-green",
        })
    });
    function msg(){
        layer.msg("上传成功")
    }
    function time(){
        laydate(
            {
                fixed: false,
                istime: true,
                format: 'YYYY-MM-DD hh:mm:ss',
                zIndex: 999999999999,
                isclear: false,
            }
        )
    }
    function delImg(id){
        $('#id'+id).remove();
    }
    $("#videos").click(function(){
        //  layer.msg('演示站无权操作！')
        // return;
        layer.open({
            type: 2,
            title: '上传视频',
            shadeClose: true,
            shade: 0.2,
            area: ['70%', '60%'],
            skin:'shangchuantup',
            content: '{:url("index/videoUploads")}',
            shift:-1,
            scrollbar: false,
            moveType: 1,
            moveOut: true
        });
    })

    function chan(obj){
        if ($(obj).val() == 3) {
            $('#videoDiv').show();
            $('#coverDiv').show();
            $('#imageDiv').hide();
            $('#imagasdasd').hide();
        } else {
            $('#videoDiv').hide();
            $('#coverDiv').hide();
            $('#imageDiv').show();
            $('#imagasdasd').show();
        }
    }
</script>
{include file="public/bottom" /}

